/**********************************************************************
 *<
	FILE: SungiLExporter.cpp

	DESCRIPTION:	Appwizard generated plugin

	CREATED BY: 

	HISTORY: 

 *>	Copyright (c) 2000, All Rights Reserved.
 **********************************************************************/

#include "SungiLExporter.h"

#define SUNGILEXPORTER_CLASS_ID	Class_ID(0x15b54ba0, 0x2ed39030)

//#define SUNGILEXPORTER_CLASS_ID	Class_ID(0x5cc12aed, 0x5b9f1e55)

#include "Exporter.h"

bool		gIsAlwaysSample		= FALSE;
bool		gIsAnimationModel	= FALSE;
bool		gIsBinaryFile		= FALSE;
bool		gIsSkinning			= FALSE;
bool		gInverseKinematics	= FALSE;

//Exporter g_Exporter;


class SungiLExporter : public SceneExport {
	public:


		static HWND hParams;

		Exporter*		m_pExporter;


		int				ExtCount();					// Number of extensions supported
		const TCHAR *	Ext(int n);					// Extension #n (i.e. "3DS")
		const TCHAR *	LongDesc();					// Long ASCII description (i.e. "Autodesk 3D Studio File")
		const TCHAR *	ShortDesc();				// Short ASCII description (i.e. "3D Studio")
		const TCHAR *	AuthorName();				// ASCII Author name
		const TCHAR *	CopyrightMessage();			// ASCII Copyright message
		const TCHAR *	OtherMessage1();			// Other message #1
		const TCHAR *	OtherMessage2();			// Other message #2
		unsigned int	Version();					// Version number * 100 (i.e. v3.01 = 301)
		void			ShowAbout(HWND hWnd);		// Show DLL's "About..." box

		BOOL SupportsOptions(int ext, DWORD options);
		int				DoExport(const TCHAR *name,ExpInterface *ei,Interface *i, BOOL suppressPrompts=FALSE, DWORD options=0);


		
		//Constructor/Destructor

		SungiLExporter();
		~SungiLExporter();		

};


class SungiLExporterClassDesc:public ClassDesc2 {
	public:
	int 			IsPublic() { return TRUE; }
	void *			Create(BOOL loading = FALSE) { return new SungiLExporter(); }
	const TCHAR *	ClassName() { return GetString(IDS_CLASS_NAME); }
	SClass_ID		SuperClassID() { return SCENE_EXPORT_CLASS_ID; }
	Class_ID		ClassID() { return SUNGILEXPORTER_CLASS_ID; }
	const TCHAR* 	Category() { return GetString(IDS_CATEGORY); }

	const TCHAR*	InternalName() { return _T("SungiLExporter"); }	// returns fixed parsable name (scripter-visible name)
	HINSTANCE		HInstance() { return hInstance; }				// returns owning module handle

};



static SungiLExporterClassDesc SungiLExporterDesc;
ClassDesc2* GetSungiLExporterDesc() { return &SungiLExporterDesc; }

DWORD WINAPI fn(LPVOID arg)
{
	return(0);
}

BOOL CALLBACK SungiLExporterOptionsDlgProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam) {
	static SungiLExporter *imp = NULL;

	switch(message) {
		case WM_INITDIALOG:
			imp = (SungiLExporter *)lParam;
			CenterWindow(hWnd,GetParent(hWnd));
			return TRUE;

		case WM_CLOSE:
			EndDialog(hWnd, 0);
			return TRUE;
	}
	return FALSE;
}


//--- SungiLExporter -------------------------------------------------------
SungiLExporter::SungiLExporter()
{
    SAFE_ZERO( m_pExporter );
	SAFE_NEW( m_pExporter , Exporter );
}

SungiLExporter::~SungiLExporter() 
{
    SAFE_DEL( m_pExporter );
	SAFE_ZERO( m_pExporter );
}

int SungiLExporter::ExtCount()
{
	//TODO: Returns the number of file name extensions supported by the plug-in.
	return 1;
}

const TCHAR *SungiLExporter::Ext(int n)
{		
	//TODO: Return the 'i-th' file name extension (i.e. "3DS").
	return _T("HJ");
}

const TCHAR *SungiLExporter::LongDesc()
{
	//TODO: Return long ASCII description (i.e. "Targa 2.0 Image File")
	return _T("Hujub Exporter");
}
	
const TCHAR *SungiLExporter::ShortDesc() 
{			
	//TODO: Return short ASCII description (i.e. "Targa")
	return _T("Hujub Exporter");
}

const TCHAR *SungiLExporter::AuthorName()
{			
	//TODO: Return ASCII Author name
	return _T("");
}

const TCHAR *SungiLExporter::CopyrightMessage() 
{	
	// Return ASCII Copyright message
	return _T("");
}

const TCHAR *SungiLExporter::OtherMessage1() 
{		
	//TODO: Return Other message #1 if any
	return _T("");
}

const TCHAR *SungiLExporter::OtherMessage2() 
{		
	//TODO: Return other message #2 in any
	return _T("");
}

unsigned int SungiLExporter::Version()
{				
	//TODO: Return Version number * 100 (i.e. v3.01 = 301)
	return 100;
}

void SungiLExporter::ShowAbout(HWND hWnd)
{			
	// Optional
}

BOOL SungiLExporter::SupportsOptions(int ext, DWORD options)
{
	// TODO Decide which options to support.  Simply return
	// true for each option supported by each Extension 
	// the exporter supports.

	return TRUE;
}


int	SungiLExporter::DoExport(const TCHAR *name,ExpInterface *ei,Interface *i, BOOL suppressPrompts, DWORD options)
{
	//TODO: Implement the actual file Export here and 
	//		return TRUE If the file is exported properly

	/*
	if(!suppressPrompts)
		DialogBoxParam(hInstance, 
				MAKEINTRESOURCE(IDD_PANEL), 
				GetActiveWindow(), 
				SungiLExporterOptionsDlgProc, (LPARAM)this);
				*/				

	i->ProgressStart( GetString( IDS_PROGRESS_MSG ) , TRUE , fn , NULL );

	m_pExporter->Init( name , ei , i );
	m_pExporter->Frame();
	m_pExporter->OutputExport();

	i->ProgressEnd();

	m_pExporter->Release();

	return TRUE;
}


